import http from '@/libs/http/index'
const basePath = 'http://localhost:8080/'
import userinfo from './mock/login/userinfo.json'
import axios from "axios";
export default {
  async userLogin(params: { username: string; password: string }) {
    const axiosResponse = await axios.post(basePath + 'user/login', params);
    return axiosResponse.data;
    // return Promise.resolve({ code: 200, msg: 'success', data: 'xxxxxxxx' })
  },
  smsLogin(params: { phone: string; vcode?: string }) {
    return Promise.resolve({ code: 200, msg: 'success', data: 'xxxxxxxx' })
  },
  sendLoginSms(params: { phone: string }) {
    return Promise.resolve({ code: 200, msg: 'success' })
  },
  logout() {
    return Promise.resolve({ code: 200, msg: 'success' })
  },
  getUserInfo() {
    return Promise.resolve(userinfo)
  },
  async userRegister(params: { password: string | undefined; username: string | undefined }) {
    const axiosResponse = await axios.post(basePath + 'user/register', params);
    return axiosResponse.data;
  }
}
